From: Colin Walters Date: Wed, 9 Aug 2017 13:07:11 +0000 (-0400) Subject: lib/deploy: Close test suite race condition X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~33^2~17 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=95c832b4e22dab7a26d815ee8e94e04f733bd66d;p=ostree.git lib/deploy: Close test suite race condition Saw this in a PR result; we need to wait for the child to have written its result to stderr before we exit, otherwise the test suite may not read it in time. Closes: #1070 Approved by: jlebon --- diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 622f9975..18624640 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -1083,7 +1083,12 @@ fsfreeze_thaw_cycle (OstreeSysroot *self, return glnx_throw_errno_prefix (error, "write(watchdog start)"); /* Testing infrastructure */ if (debug_fifreeze) - return glnx_throw (error, "aborting due to test-fifreeze"); + { + int wstatus; + /* Ensure the child has written its data */ + (void) TEMP_FAILURE_RETRY (waitpid (pid, &wstatus, 0)); + return glnx_throw (error, "aborting due to test-fifreeze"); + } /* Do a freeze/thaw cycle; TODO add a FIFREEZETHAW ioctl */ if (ioctl (rootfs_dfd, FIFREEZE, 0) != 0) {